package com.itheima.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealAndCheckGroupMapper {
    /**
     * 通过setmealId查询关联表中checkGroupId
     * @param setMealId
     */
    @Select("select checkgroup_id from setmeal_checkgroup where setmeal_id=#{setMealId}")
    List<Integer> getCheckGroupIdBysetmealId(Integer setMealId);

    /**
     * 新增套餐和检查组的关系
     * @param setmealId
     * @param checkGroupIdsInt
     */
    void insert(int setmealId, List<Integer> checkGroupIdsInt);
    /**
     * 根据setmealId删除相关关联表
     * @param setmealId
     */
    @Delete("delete from setmeal_checkgroup where setmeal_id=${setmealId}")
    void deleteBysetmealId(Integer setmealId);
}
